/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.K250;
import queenb.net.entitybean.V200;
import queenb.web.inteface.V200Inf;
import queenb.web.util.PackageContants;

/**
 *
 * @author VANANH
 */
public class V200Store extends V200 implements V200Inf {

    @Override
    public List<V200> getListV200All(int pnFH000, int pnFH200, String pvLOGIN) {
        try {
            DataStatement data = new DataStatement(PackageContants.LIST_V200, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(data, V200.class);
        } catch (SQLException ex) {
            Logger.getLogger(V200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(V200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(V200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    @Override
    public int updateV200(int pnPV200, int pnFH000, int pnFH200, String pvVV201, String pvVV202, String pvLOGIN) {
        DataStatement dataStetament = new DataStatement(PackageContants.UPDATE_V200, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnPV200),
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.CHAR, pvVV201),
                    new Param(OracleTypes.CHAR, pvVV202),
                    new Param(OracleTypes.CHAR, pvLOGIN),});
        try {
            return super.update(dataStetament, V200.class);
        } catch (SQLException ex) {
            Logger.getLogger(V200Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }

    @Override
    public int deleteV200(int pnPV200, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.DELETE_V200, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPV200),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.update(dataStatement, V200.class);
        } catch (SQLException ex) {
            Logger.getLogger(V200Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }

    @Override
    public List<V200> getListCombV200(int pnFH000, int pnFH200, String pvLOGIN) {
        try {
            DataStatement data = new DataStatement(PackageContants.LIST_COMBV200, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(data, V200.class);
        } catch (SQLException ex) {
            Logger.getLogger(V200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(V200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(V200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
    @Override
    public List<V200> getListCombV200DV(int pnFH000, int pnFH200,int pbFN750, int pnFA000, int pnFK100, String pvLOGIN) {
        try {
            DataStatement data = new DataStatement(PackageContants.LIST_COMBV200_DV, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pbFN750),
                        new Param(OracleTypes.INTEGER, pnFA000),
                        new Param(OracleTypes.INTEGER, pnFK100),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(data, V200.class);
        } catch (SQLException ex) {
            Logger.getLogger(V200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(V200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(V200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
}
